﻿Public Class Listado_Clientes
    Dim acceso As New acceso()
    Private Sub Listado_Clientes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        datos_clientes()

        acceso.cargarCombo(cmb_Responsable, "ResponsableInscripto", "nombre", "idResponsable")
        chk_todos.Checked = True
        GRB_filtro.Enabled = False

    End Sub
    Private Sub datos_clientes()
        Dim tabla As New Data.DataTable()
        tabla = acceso.leo_tabla("VistaClientes where nroCliente != 3")
        DS_Listado_ClientesBindingSource.DataSource = tabla
        ReportViewer1.RefreshReport()
    End Sub

    Private Sub datos_clientes_filtrado()
        Dim tabla As New Data.DataTable()
        tabla = acceso.leo_tabla("VistaClientes where nroCliente != 3 and idResponsable = " & cmb_Responsable.SelectedValue)
        DS_Listado_ClientesBindingSource.DataSource = tabla
        ReportViewer1.RefreshReport()
    End Sub


    Private Sub chk_todos_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk_todos.CheckedChanged
        If chk_todos.Checked = True Then
            GRB_filtro.Enabled = False
            datos_clientes()
        Else
            GRB_filtro.Enabled = True
        End If

    End Sub

    Private Sub btn_filtro_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_filtro.Click
        datos_clientes_filtrado()
    End Sub
End Class